#include "MyStruct.h"

static void hello() {
        printf("hello,point!\r\n");
}

struct_type1 st1 = {
	.type = 1,
	.data = 2
};
struct_type2 st2 = {
	.type = 2,
	.func = hello
};

void test1() {
	struct_type* st[2];

	st[0] = (struct_type*)&st1;
	st[1] = (struct_type*)&st2;
	int size = 2;
	for(int i=0;i<size ;i++) {
		switch(st[i]->type) {
			case 1:{
				struct_type1 *pst1 = (struct_type1*)st[i];
				pst1->data = 3;
				printf("%d\t%d\r\n",pst1->type,pst1->data);
			}break;
			case 2:{
				struct_type2 *pst2 = (struct_type2*)st[i];
				printf("%d\t",pst2->type);
				pst2->func();
			}break;
		}
	}
}